package com.wjjzst.common.utils.file;


public class OSUtil {
    // Operating systems.
    public enum OS {
        WINDOWS, LINUX, MAC, SOLARIS
    }


    private static OS os = null;

    public static OS getOS() {
        if (os == null) {
            String operationSystem = System.getProperty("os.name").toLowerCase();
            if (operationSystem.contains("win")) {
                os = OS.WINDOWS;
            } else if (operationSystem.contains("nix") || operationSystem.contains("nux")
                    || operationSystem.contains("aix")) {
                os = OS.LINUX;
            } else if (operationSystem.contains("mac")) {
                os = OS.MAC;
            } else if (operationSystem.contains("sunos")) {
                os = OS.SOLARIS;
            }
        }
        return os;
    }

    public static String getBaseDir() {
        switch (getOS()) {
            case WINDOWS:
                return "C:/Users/wjj/";
            case MAC:
                return "/Users/wjj/";
            case LINUX:
                return "/home/wjj/";
            default:
                throw new RuntimeException("Unsupported os");
        }
    }
//    public static void main(String[] args) {
//        System.out.println(getBaseDir());
//    }
}
